#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H

#include <QCamera>
#include <QCheckBox>
#include <QGraphicsVideoItem>
#include <QGraphicsView>
#include <QVideoWidget>
#include <QWidget>
class videoWidget : public QWidget
{
    Q_OBJECT
public:
    explicit videoWidget(QWidget *parent = nullptr);
    ~videoWidget();
    void showVideo();
    void cameraVideoNoMirror();

    bool cameraStatus();

private:
    void InitCameraVideo(bool isFlip);
protected slots:
    void onMirrorToogle(bool checked);
public slots:
    void stopVideo();
signals:
    void stopped();

private:
    QGraphicsScene *scene; //这是一个场景（容器），存放将要显示的图形项的内容
    QGraphicsView *view;   //显示场景中的图形项
    //QVideoWidget *vW; //视频显示空间窗口

    QCheckBox *MirrorBox;
    QCheckBox *noiseReductionBox;
    QCheckBox *darkSceneBox;
    //QGraphicsVideoItem *videoItem;
    //QMediaCaptureSession *captureSession;
    QCameraDevice cameraDevice;
    QCamera *camera; //这是一个摄像头对象
    std::unique_ptr<QGraphicsVideoItem> videoItem;
    std::unique_ptr<QMediaCaptureSession> captureSession;
};

#endif // VIDEOWIDGET_H
